package com.homeparking.manage.service.impl;

import java.util.List;
import java.util.Map;

import com.homeparking.common.annotation.DataScope;
import com.homeparking.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.homeparking.manage.mapper.ManageRecordMapper;
import com.homeparking.manage.domain.ManageRecord;
import com.homeparking.manage.service.IManageRecordService;

/**
 * 备案订单Service业务层处理
 * 
 * @author liuyangyang
 * @date 2025-05-04
 */
@Service
public class ManageRecordServiceImpl implements IManageRecordService 
{
    @Autowired
    private ManageRecordMapper manageRecordMapper;

    /**
     * 查询备案订单
     * 
     * @param recordId 备案订单主键
     * @return 备案订单
     */
    @Override
    public ManageRecord selectManageRecordByRecordId(String recordId)
    {
        return manageRecordMapper.selectManageRecordByRecordId(recordId);
    }

    /**
     * 拉取备案信息
     *
     * @param manageRecord 备案信息
     * @return 结果
     */
    @Override
    public int pullManageRecord(List<ManageRecord> manageRecord)
    {

        return manageRecordMapper.pullManageRecord(manageRecord);
    }

    /**
     * 统计每天备案数据
     *
     * @param params 开始时间,结束时间
     * @return 结果
     */
    @Override
    public List<Map<String, Object>> countEveryday(String startTime,String endTime){

        return manageRecordMapper.countEveryday(startTime,endTime);
    }

    /**
     * 查询备案订单列表
     * 
     * @param manageRecord 备案订单
     * @return 备案订单
     */
    @Override
    @DataScope(userAlias = "u")
    public List<ManageRecord> selectManageRecordList(ManageRecord manageRecord)
    {
        return manageRecordMapper.selectManageRecordList(manageRecord);
    }

    /**
     * 新增备案订单
     * 
     * @param manageRecord 备案订单
     * @return 结果
     */
    @Override
    public int insertManageRecord(ManageRecord manageRecord)
    {
        manageRecord.setCreateTime(DateUtils.getNowDate());
        return manageRecordMapper.insertManageRecord(manageRecord);
    }

    /**
     * 修改备案订单
     * 
     * @param manageRecord 备案订单
     * @return 结果
     */
    @Override
    public int updateManageRecord(ManageRecord manageRecord)
    {
        manageRecord.setUpdateTime(DateUtils.getNowDate());
        return manageRecordMapper.updateManageRecord(manageRecord);
    }

    /**
     * 批量删除备案订单
     * 
     * @param recordIds 需要删除的备案订单主键
     * @return 结果
     */
    @Override
    public int deleteManageRecordByRecordIds(String[] recordIds)
    {
        return manageRecordMapper.deleteManageRecordByRecordIds(recordIds);
    }

    /**
     * 删除备案订单信息
     * 
     * @param recordId 备案订单主键
     * @return 结果
     */
    @Override
    public int deleteManageRecordByRecordId(String recordId)
    {
        return manageRecordMapper.deleteManageRecordByRecordId(recordId);
    }
}
